package com.snbc.zookeper;

import org.junit.Before;
import org.junit.Test;

/**
 * @author shichenguang
 * @desciption 描述
 * @date 2020-03-17 17:08
 */
public class ZKUtilTest {
    private ZookeeperUtil zookeeperUtil;

    @Before
    public void getInstance(){
        zookeeperUtil = new ZookeeperUtil(null);

    }

    // String znodeData = zookeeperUtil.getZnodeData("/scg");
    @Test
    public void  deleteZNode(){
        boolean b = zookeeperUtil.deleteZnode("/scg");
        System.out.println(b);
    }

    @Test
    public  void createZNode(){

        String data = "this is third2";
        boolean b = zookeeperUtil.addPersistentNode("/scg", data);
        System.out.println(b);

    }

    @Test
    public void getZnodeData(){
        String znodeData = zookeeperUtil.getZnodeData("/scg");
        System.out.println(znodeData);
    }
    @Test
    public void updateData(){
        String data = "this is third3";
        boolean flag = zookeeperUtil.updataZnode("/scg",data);
        System.out.println(flag);
    }
}
